<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()

// 处理预约请求
const handleBookNow = (furnitureId) => {
  router.push({ name: 'booking', params: { id: furnitureId } })
}
</script>

<template>
  <div class="app-container">
    <!-- 导航栏 -->
    <nav class="navbar">
      <div class="logo">家具</div>
      <div class="nav-links">
        <router-link to="/">家具列表</router-link>
        <router-link to="/booking">到店预约</router-link>
      </div>
    </nav>

    <!-- 路由出口 -->
    <router-view @bookNow="handleBookNow" />
  </div>
</template>

<style scoped>
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  font-family: 'Arial', sans-serif;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background-color: #333;
  color: white;
}

.logo {
  font-size: 24px;
  font-weight: bold;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: #42b883;
}

.router-view {
  padding: 20px;
}
</style>
